// 函数重载
function overLoadFunction(obj, funName, fun) {
    const old = obj[funName]
    obj[funName] = function() {
        if (argements.length === fun.length) {
           return fun.apply(this, argements)
        } else if (typeof old === 'function') {
           return old.apply(this, arguments)
        }
    }
}

const obj = {}

overLoadFunction(obj, 'getUsers', function () {
    console.log('获取所有用户')
})

overLoadFunction(obj, 'getUsers', function (page) {
    console.log('获取第一页用户，默认十个')
})

overLoadFunction(obj, 'getUsers', function (page, size) {
    console.log('获取姓张，性别为男的用户')
})

overLoadFunction(obj, 'getUsers', function (name, gender, age) {
    console.log('获取姓张，性别为男，年龄为18的用户')
})

obj.getUsers()
obj.getUsers(1)
obj.getUsers(1, 20)
obj.getUsers('lh', '1', 20)